<?php slot('sub', $sub); ?>
<?php slot('menu', $menu); ?>
<?php slot('user', $user); ?>

<link media="screen" type="text/css" rel="stylesheet" href="/web/css/vaucher.css" />
<link media="print, handheld" type="text/css" rel="stylesheet" href="/web/css/client_voucher.css" />
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyA4ORL54bd4TqneYqWekkc22xhZ1T3gH6A&sensor=false"></script>

<div class="center">
    <div class="center_vaucher_container">
        <span class="not_print">
            <div class="vaucher_title">
                <div class="vaucher_title_date"><?php echo sbValues::getDateToDB() ?></div>
                <div class="vaucher_button_home"><a href="<?php echo url_for('hotels') ?>">Home</a></div>
                <div class="vaucher_button_help"><a href="">Help</a></div>
            </div>

            <div class="vaucher_client_name_title">Dear <?php echo $order['order']['main_first_name'] . ' ' . $order['order']['main_last_name'] ?></div>

            <div class="vaucher_orders_container">
                <div class="vaucher_order_id">
                    <label>Order #</label>
                    <div class="vaucher_order_id_field"><?php echo $order['order']['id'] ?></div>
                </div>
                <div class="vaucher_date_order">
                    <label>Order Date</label>
                    <div class="vaucher_date_order_field"><?php echo $order['order']['from_date'] ?></div>
                </div>
            </div>

            <div class="vaucher_line_text_standart">Thank you for ordering from www.troli.co.il</div>
            <div class="vaucher_line_text_standart">Your order has been successfully created and the transaction is being processed.</div>
            <div class="vaucher_line_text_standart">Details of your transaction:</div>

            <div class="vaucher_items_main_container">
                <div class="vaucher_items_container">
                    <div class="vaucher_item_title">Item(s)</div>
                    <div class="vaucher_price_title">Price</div>
                </div>

                <?php
                foreach ($order['rooms'] as $r) {
                    echo '<div class="vaucher_items_container">'
                    . '<div class="vaucher_item">' . $r['name'] . '</div>'
                    . '<div class="vaucher_price">' . $order['order']['amount'] . '</div>'
                    . '</div>';
                }
                ?>

<!--                <div class="vaucher_items_container">
                    <div class="vaucher_item">Item(s)</div>
                    <div class="vaucher_price">Price</div>
                </div>-->

                <div class="vaucher_items_container">
                    <label>Total</label>
                    <div class="vaucher_price"><?php echo $order['order']['amount'] ?></div>
                </div>

                <?php 
                $typesPayment = array('paypal', 'credit card', 'phone', 'balance', 'agent');
                $payment = $typesPayment[$order['order']['payment_type']];
                ?>

                <div class="vaucher_items_container">
                    <label>Payment</label>
                    <div class="vaucher_price"><?php echo $payment ?></div>
                </div>
            </div>
        </span>

        <div id="client_vaucher">
            <div class="client_vaucher_header">
                <h3>Client's Voucher</h3>
                <h5>Please keep it voucher during all your travel</h5>
            </div>
            <div class="client_hotel_container">
                <div class="client_hotel_booking">
                    <div class="client_booking_info">
                        <img src="/web/images/imgLogo.png">
                        <div class="client_short_line_hb">
                            <label>Booking #</label>
                            <div class="client_border_line"><?php echo $order['order']['provider_id'] ?></div>
                        </div>
                        <div class="client_short_line_hb">
                            <label>Internal Booking #</label>
                            <div class="client_border_line"><?php echo $order['order']['id'] ?></div>
                        </div>
                        <div class="client_short_line_hb">
                            <label>Date of Booking</label>
                            <div class="client_border_line"><?php echo sbValues::getDateToDB() ?></div>
                        </div>
                    </div>
                    <hr>
                    <div class="client_hotel_info">
                        <img class="client_image_hi" src="/web/images/icoHotels.png">
                        <img class="client_rank_hi" src="/web/images/icoStars5.png">
                        <div class="client_short_line_hb">
                            <label>Hotel</label>
                            <div class="client_border_line_hi"><?php echo $order['hotel']['name_en'] ?></div>
                        </div>
                        <div class="client_short_line_hb">
                            <label>Address</label>
                            <div class="client_border_line_hi"><?php echo $order['hotel']['address'] ?></div>
                        </div>
                        <div class="client_short_line_hb">
                            <label>Phone</label>
                            <div class="client_border_line_hi"><?php echo $order['hotel']['phone1'] ?></div>
                        </div>
                        <div class="client_short_line_hb">
                            <label>Fax</label>
                            <div class="client_border_line_hi"><?php echo $order['hotel']['fax'] ?></div>
                        </div>
                    </div>
                </div>
                <div class="client_hotel_map" id="voucher_map">

                </div>
            </div>
            <hr class="short_line_separator">
            
            <?php 
            $coutnRoom = 0;
            foreach($order['rooms'] as $r) {
                $coutnRoom++;
                echo '<div class="client_voucher_rooms">'
                . '<img class="client_image_hi" src="/web/images/icoAppartments.png">'
                        . '<div class="client_voucher_room_header">'
                        . '<div class="clvrh_room_title">Room</div>'
                        . '<div class="clvrh_room">#'.$coutnRoom.'</div>'
                        . '<div class="clvrh_room_type">'.$r['name'].'</div>'
                        . '<div class="clvrh_date_in_title">Check-in</div>'
                        . '<div class="clvrh_date_in">'.$order['order']['from_date'].'</div>'
                        . '<div class="clvrh_date_out_title">Check-out</div>'
                        . '<div class="clvrh_date_out">'.$order['order']['to_date'].'</div>'
                        . '<div class="clvrh_board_title">Board</div>'
                        . '<div class="clvrh_board">Bed & Breakfast</div>'
                        . '</div>'
                        . '<div class="client_voucher_room_guest">'
                        . '<div class="cvrg_title_guest">Guest</div><div class="cvrg_title_age">Age</div></div>'
                        . '<div class="client_voucher_room_guest">'
                        . '<div class="cvrg_guest">'.$order['order']['main_first_name'].' '.$order['order']['main_last_name'].'</div></div>'
                        . '</div><hr class="short_line_separator">';
            } ?>
            
<!--            <div class="client_voucher_rooms">
                <img class="client_image_hi" src="/web/images/icoAppartments.png">
                <div class="client_voucher_room_header">
                    <div class="clvrh_room_title">Room</div>
                    <div class="clvrh_room">#1</div>
                    <div class="clvrh_room_type">Double</div>
                    <div class="clvrh_date_in_title">Check-in</div>
                    <div class="clvrh_date_in">2014-06-10</div>
                    <div class="clvrh_date_out_title">Check-out</div>
                    <div class="clvrh_date_out">2014-06-13</div>
                    <div class="clvrh_board_title">Board</div>
                    <div class="clvrh_board">Bed & Breakfast</div>
                </div>
                <div class="client_voucher_room_guest">
                    <div class="cvrg_title_guest">Guest</div>
                    <div class="cvrg_title_age">Age</div>
                </div>
                <div class="client_voucher_room_guest">
                    <div class="cvrg_guest">Konstantin Khotski</div>
                    <div class="cvrg_age">Only for children</div>
                </div>
                <div class="client_voucher_room_guest">
                    <div class="cvrg_guest">Konstantin Khotski</div>
                    <div class="cvrg_age">Only for children</div>
                </div>
            </div>
            <hr class="short_line_separator">-->

            <div class="client_voucher_special">
                <img class="client_image_hi" src="/web/images/icoHow.png">
                <div class="cvs_special_information">
                    Please note that, according to Israeli tax law, all hotels costs quoted for tourists are exempt of VAT.
                    Israelis however, will be subject to 18% VAT, so 18% must be added to the hotel bill (rooms and meals) for all Israeli quests should you have some.
                    Guests who enter Israel using their foreign passport, under VIsa entry B2/B3 (Regular tourist visas) and their stay is less
                    than 90 days, will not be charged VAT on their hotel bill.
                </div>
            </div>
            <hr class="short_line_separator">
            <div class="client_voucher_footer">
                <img class="client_image_hi" src="/web/images/imgLogo.png">
                <img class="client_image_hir" src="/web/images/imgLogo.png">
                <div class="cvf_text">Thanks for choosing Troli.co.il and Agency site(if exists or Travis), we look forward to serving you!</div>
            </div>
        </div>

        <span class="not_print">
            <div class="vaucher_title">
                <div class="vaucher_button_print">Print Voucher</div>
                <div class="vaucher_button_home"><a href="<?php echo url_for('hotels') ?>">Home</a></div>
                <div class="vaucher_button_help"><a href="">Help</a></div>
            </div>
        </span>
    </div>
</div>

<script>
    var save;
    $(function() {
        $('.vaucher_button_print').on('click', function() {
            window.print();
        });

        setTimeout(createHotelMap, 200);
    });

    function createHotelMap() {
        var position = [29.5513522, 34.9643545];
        var location = new google.maps.LatLng(position[0], position[1]);

        var mapOptions = {
            center: location,
            mapTypeControl: false,
            zoomControl: false,
            disableDefaultUI: true,
            zoom: 16,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("voucher_map"), mapOptions);

        var marker = new google.maps.Marker({
            position: location,
            map: map
        });
    }

</script>